package naito_rescue.communication.team.generator;

import java.util.*;
import sample.*;
import rescuecore2.messages.*;
import rescuecore2.worldmodel.*;
import rescuecore2.Constants;
import rescuecore2.config.*;
import rescuecore2.standard.components.*;
import rescuecore2.standard.entities.*;
import rescuecore2.standard.messages.*;
import rescuecore2.misc.geometry.*;

import naito_rescue.*;
import naito_rescue.agent.*;
import naito_rescue.communication.team.*;
import naito_rescue.communication.team.generator.*;
import naito_rescue.communication.channel.*;
import naito_rescue.object.*;
import naito_rescue.util.comm.team.*;
import naito_rescue.message.*;
import naito_rescue.message.manager.*;
import naito_rescue.util.comm.team.*;


public class NoCommunicationTeamGenerator implements ICommunicationTeamsGenerator
{
	private List<StandardEntity> allPlatoons;
	private VoiceChannel         voiceChannel;
	private Config               config;
	private MyLogger             logger;
	private int                  teamNum = 0;
	
	public NoCommunicationTeamGenerator(List<StandardEntity> allPlatoons, VoiceChannel voiceChannel,
	                                    Config config, MyLogger logger){
	                                    
		this.allPlatoons = allPlatoons;
		this.voiceChannel = voiceChannel;
		this.config = config;
		this.logger = logger;
	}
	
	@Override	
	public List<ICommunicationTeam> generateTeams(){
		List<ICommunicationTeam> result = new ArrayList<ICommunicationTeam>();
		result.add(new NoCommunicationTeam(this.allPlatoons, voiceChannel));
		return result;
	}
	private class NoCommunicationTeam implements ICommunicationTeam
	{
		private List<StandardEntity> members;
		private VoiceChannel         voiceChannel;
		
		public NoCommunicationTeam(List<StandardEntity> members, VoiceChannel voiceChannel){
			this.members = members;
			this.voiceChannel = voiceChannel;
		}
		@Override
		public List<AbstractChannel> getChannelToFB(){
			return Arrays.asList((AbstractChannel)voiceChannel);
		}
		@Override
		public List<AbstractChannel> getChannelToPF(){
			return Arrays.asList((AbstractChannel)voiceChannel);
		}
		@Override
		public List<AbstractChannel> getChannelToAT(){
			return Arrays.asList((AbstractChannel)voiceChannel);
		}
		@Override
		public AbstractChannel getMyChannel(){
			return voiceChannel;
		}
		@Override
		public List<StandardEntity> getMembers(){
			return this.members;
		}
		@Override
		public boolean isMyTurn(StandardEntity sender, int timestep){
			return true;
		}
		@Override
		public int getBandwidthPerAgent(){
			return voiceChannel.getBandwidth();
		}	
	}
}
